<?php
require 'config.php';
$user = $_REQUEST['user'];
$type = $_REQUEST['type'];
$session = $_REQUEST['session'];
$limit = $_REQUEST['limit'];
$limit = (int)$limit + 30;
//$limit = 1;
//folder
$dir_root = dirname(__FILE__);
$file = $dir_root . "/session/session_".$type."_".$user.".txt";
$fp = fopen($file, 'w');
$a_user = array();
$a_user['id'] = $user;
$a_user['type'] = $type;
$a_user['session'] = $session;
$a_user['expired'] = date("Y-m-d H:i:s", strtotime("+$limit minutes"));
$a_user['limit'] = $limit;
fwrite($fp, json_encode($a_user));
fclose($fp);
?>
